# -*- coding:utf-8 -*-
import csv

'''
处理[脂肪肝、失眠、高血压、肩颈],固定句式如下
询问句式：脂肪肝的病因、脂肪肝的症状、脂肪肝的并发症、脂肪肝的危害，脂肪肝的生活建议
这里病症如脂肪肝来自一张表，循环取值；不能吃什么该种问法一张表，循环取值；然后使用for循环嵌套完成整张表的问法。
处理：生活建议表
'''
class TestDiseaseNotFood():
    def diseaseNotFood(self):
        # 定义


        food_list = []

        with open('E:\\test\\HB\\four_vital_init.csv', 'r') as f1,\
            open("E:\\test\\HB\\four_life_advice.csv",'r')as f2:

            f11 = f1.readlines()
            f22 = f2.readlines()
            print(f11)
            print(f22)
            print(type(f11))
            print(type(f22))
            #循环读取病症的信息
            for i in range(len(f11)):
                name = f11[i]
                print(name)

                # 循环去读句式信息
                for m in range(len(f22)):
                    food_quanty = f22[m]
                    print(type(food_quanty))
                    quanty = "".join(food_quanty)

                    s = name + quanty
                    #形成的固定句式
                    s_food = s.replace("\n","")
                    print(food_quanty)
                    print("拼接的字符串固定句式是:"+s_food)

                    food_list.append(s_food)
                    print(food_list)

            #four_disease_life ，four_disease_init总表
            with open('E:\\test\\HB\\four_disease_init.csv', 'a')as f3:
                for k in  food_list:
                    f3.write(k)
                    f3.write("\n")
                f3.close()
        f2.close()
        f1.close()


if __name__ == '__main__':
    tn = TestDiseaseNotFood()
    tn.diseaseNotFood()






